const App = getApp();
// 工具类
import Util from '../../utils/util.js';
var WxParse = require('../../wxParse/wxParse.js');
Page({
  /**
   * 页面的初始数据
   */
  data: {
    isLogin: false,//登录状态
    cate_id:0,        //导航下标
    content:'',    //详情内容
    // 导航菜单
    menuList:[],
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {},

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    let that = this;
    that.setData({
      isLogin: App.checkIsLogin()
    });
    if (that.data.isLogin) {
      //活动tab分类
      that.getCate();
    }
  },
  //活动tab分类
  getCate(){
    let that = this;
    App._get('article/aboutuscate', {}, result => {
      that.setData({
        menuList: result.data.list,
        cate_id:result.data.list[0].category_id
      }); 
       //获取数据
     that.getDataList();
    });
    
  },
  //获取数据
  getDataList(){
    let that = this;
    App._get('article/aboutus', {cate_id:that.data.cate_id}, result => {
      that.setData({
        content: result.data.detail
      }); 
      if(that.data.content){
        WxParse.wxParse('content', 'html', that.data.content.introduction_content, this,5);  
      }
       
    });
  },

  // 导航切换
  onChangeNews(e){
    let that = this;
    that.setData({
      cate_id: e.currentTarget.dataset.id
    }); 
    that.getDataList();
  },

  /**
  * 分享当前页面
  */
  onShareAppMessage() {
    return {
      title: "关于我们",
      path: "pages/introduce/index"
    };
  },
  /**
   * 分享到朋友圈
   */
  onShareTimeline() {
    return {
      title: "关于我们",
      path: "pages/introduce/index"
    };
  },  

})